package com.example.temp.mapper;

import com.example.temp.entity.QuestionCategory;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface QuestionCategoryMapper {
    @Select("SELECT DISTINCT question_category FROM question_category")
    List<String> acquireTypes();

    @Insert("INSERT INTO question_category(question_category) VALUES(#{questionCategory})")
    @Options(useGeneratedKeys = true, keyProperty = "id")
    int insert(QuestionCategory category);

    @Update("UPDATE question_category SET question_category = #{questionCategory} WHERE id = #{id}")
    int updateById(QuestionCategory category);

    @Delete("DELETE FROM question_category WHERE id = #{id}")
    int deleteById(Integer id);

    @Select("SELECT * FROM question_category WHERE id = #{id}")
    QuestionCategory selectById(Integer id);

    @Select("SELECT * FROM question_category")
    List<QuestionCategory> selectList();
}